﻿namespace DatabaseGroup.SSIS.SourceAdapters.View
{
    /// <summary>
    /// A cancellable event handler for events linked to a tab
    /// </summary>
    /// <param name="sender">A reference to the event sender</param>
    /// <param name="e">A CancelTabEventArgs object</param>
    public delegate void CancelTabEventHandler(object sender, CancelTabEventArgs e);

    /// <summary>
    /// Cancellable event linked to a tab
    /// </summary>
    public class CancelTabEventArgs : TabEventArgs
    {
        /// <summary>
        /// Initializes a new instance of the CancelTabEventArgs class
        /// using the specified tab
        /// </summary>
        /// <param name="tab">The tab the event relates to</param>
        public CancelTabEventArgs(EditorViewTab tab)
            : base(tab)
        {
            this.Cancel = false;
        }

        /// <summary>
        /// Initializes a new instance of the CancelTabEventArgs class
        /// using the specified tab and cancel status
        /// </summary>
        /// <param name="tab">The tab the event relates to</param>
        /// <param name="cancel">True if the event should be cancelled</param>
        public CancelTabEventArgs(EditorViewTab tab, bool cancel)
            : base(tab)
        {
            this.Cancel = cancel;
        }

        /// <summary>
        /// Gets or sets if the event should be cancelled
        /// </summary>
        public bool Cancel { get; set; }
    }
}
